#ifndef __BUFFERDEQUE_HPP__
#define __BUFFERDEQUE_HPP__

namespace purewell
{

class PWBufferDeque : public PWBuffer
{
public:
	virtual ssize_t read(void* buf, size_t blen) const;
	virtual ssize_t readAndSkip(void* buf, size_t blen);
	virtual ssize_t skip(size_t blen);
	virtual ssize_t write(const void* buf, size_t blen);
	inline virtual size_t getCapacity(void) const {return (size_t)-1 -1;}
	inline virtual size_t getCurrentSize(void) const {return m_buf.size();}
	inline virtual int getType(void) const {return PWBUF_DEQUE;}
	inline virtual bool getAutoSize(void) const {return true;}
	inline virtual void clear(void) { m_buf.clear(); }
	inline virtual bool isEmpty(void) const { return m_buf.empty(); }
	virtual ssize_t readLine(void* buf, size_t blen) const;
	virtual ssize_t readLineAndSkip(void* buf, size_t blen);

public:
	explicit PWBufferDeque();
	virtual ~PWBufferDeque();

private:
	typedef std::deque<char>			buffer_t;
	typedef buffer_t::iterator			buffer_itr;
	typedef buffer_t::const_iterator	buffer_citr;

private:
	buffer_t	m_buf;
};

};//namespace purewell

#endif//!__BUFFERDEQUE_HPP__

